<%@page import="cn.jhc.bean.ActBean"%>
<%@page import="cn.jhc.dao.ShowmvDAO"%>
<%@page import="cn.jhc.bean.ShowmvBean"%>
<%@page import="cn.jhc.dao.ActivitiesDAO"%>
<%@page import="cn.jhc.dao.ConnectionFactory"%>
<%@page import="cn.jhc.dao.NewsDAO"%>
<%@page import="cn.jhc.bean.NewsBean"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css"></link>
<script type="text/javascript">
	function MM_popupMsg(msg) {
		alert(msg);
	}
</script>
<style>
* {
	border: 0;
}
</style>
<title>蓝调吉他社</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="./header.jsp"></jsp:include>
		<div id="address">
			<a>当前位置： 首页</a>
		</div>
		<div id="wrapperdown">
			<div id="center">
				<div class="image1">
					<a><img src="images/jt1.jpg" width="500"></a>
				</div>
				<div class="image2">
					<a><img src="images/jt2.jpg" width="500"></a>
				</div>
				<div class="image3">
					<a><img src="images/jt3.jpg" width="500"></a>
				</div>
				<div class="image4">
					<a><img src="images/jt4.jpg" width="500"></a>
				</div>
				<div class="image5">
					<a><img src="images/jt5.jpg" width="500"></a>
				</div>
			</div>
			<div id="wrapperbg"></div>
			<div id="sheng"></div>
			<div id="sheng2"></div>
			<div id="wrappernews">
				<div id="quan"></div>
				<div id="quan2"></div>
				<div id="title">
					<a href="news.jsp">校园新闻</a>
				</div>
				<div id="title_line"></div>
				<%
					ArrayList<NewsBean> list = new ArrayList<NewsBean>();
					NewsDAO dao = new NewsDAO();
					dao.setCon(ConnectionFactory.getConnection());
					list = dao.getAllNews(1, 10);
					request.setAttribute("news", list);
				%>
				<div id="news_line">
					<table width="270">
						<c:forEach items="${requestScope.news}" var="news">
							<tr>
								<td height="27"><div id="newstitle" align="left">
										<img src="images/jiantou.gif"></img><a
											href="newscontext.jsp?id=${news.id}" title="${news.title}"> ${news.title}</a>
									</div></td>
								<td><div align="right">
										<a>${news.date}</a>
									</div></td>
							</tr>
						</c:forEach>
					</table>
				</div>
				<div id="quan3"></div>
				<div id="more">
					<a href="news.jsp">MORE>></a>
				</div>
			</div>
			<div id="sheng3"></div>
			<div id="sheng4"></div>
			<%
				ShowmvBean a = new ShowmvBean();
				ShowmvDAO showdao = new ShowmvDAO();
				showdao.setCon(ConnectionFactory.getConnection());
				a = showdao.getOneTitle();
				request.setAttribute("onetitle", a);
			%>
			<div id="wrapperact">
				<div id="quan"></div>
				<div id="quan2"></div>
				<div id="title">
					<a>上届每月之星</a>
				</div>
				<div id="title_line"></div>
				<div id="actdown">
					<div id="actdown_image">
						<a  href="showonemv.jsp?id=${requestScope.onetitle.id}"><img src="UserFiles/Flash/${requestScope.onetitle.imagename}" width="200" height="180"></a>
					</div>
					<div id="actdown_title">
						<a href="showonemv.jsp?id=${requestScope.onetitle.id}">${requestScope.onetitle.title}</a>
					</div>
				</div>
			</div>
			<div id="sheng5"></div>
			<div id="sheng6"></div>
			<div id="wrapperweak">
				<div id="quan"></div>
				<div id="quan2"></div>
				<div id="title">
					<a href="activities.jsp">活动信息</a>
				</div>
				<div id="title_line"></div>
				<%
					ArrayList<ActBean> listA = new ArrayList<ActBean>();
					ActivitiesDAO daoA = new ActivitiesDAO();
					daoA.setCon(ConnectionFactory.getConnection());
					listA = daoA.getAllActivities(1, 10);
					request.setAttribute("activities", listA);
				%>
				<div id="news_line">
					<table width="270">
						<c:forEach items="${requestScope.activities}" var="activities">
							<tr>
								<td height="27"><div id="newstitle" align="left">
										<img src="images/jiantou.gif"></img><a
											href="activitiescontext.jsp?id=${activities.id}" title="${activities.title}">
											${activities.title}</a>
									</div></td>
								<td><div align="right">
										<a>${activities.date}</a>
									</div></td>
							</tr>
						</c:forEach>
					</table>
				</div>
				<div id="more">
					<a href="activities.jsp">MORE>></a>
				</div>
				<div id="quan3"></div>
			</div>
			<div id="sheng7"></div>
			<div id="sheng8"></div>
			<div id="images_title">
				<div id="quan4"></div>
				<div id="quan5"></div>
					<a>每月之星评选</a>
			</div>
			<div id="images_show">
			<% 
				ArrayList<ShowmvBean> s = new ArrayList<ShowmvBean>();
				ShowmvDAO dao2 = new ShowmvDAO();
				dao2.setCon(ConnectionFactory.getConnection());
				s = dao2.getAllTitle(1,10);
				request.setAttribute("mv", s);
			%>
				<div class="rollBox">
					<div class="LeftBotton" onmousedown="ISL_GoUp()"
						onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()"></div>
					<div class="Cont" id="ISL_Cont">
						<div class="ScrCont">
							<div id="List1">
							<c:forEach items="${requestScope.mv}" var="mv">
								<div class="pic">
									<a href="showonemv.jsp?id=${mv.id}" target="_blank" title="${mv.title}"><img src="UserFiles/Flash/${mv.imagename}" width="190"
										height="160" /></a>
								</div>
							</c:forEach>
							</div>
							<div id="List2"></div>
						</div>
						<div class="RightBotton" onmousedown="ISL_GoDown()"
							onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()"></div>
					</div>
					<div id="quan6"></div>
					<div id="quan7"></div>
				</div>
				<script language="javascript" type="text/javascript">
					var Speed =1; //速度(毫秒)
					var Space = 2; //每次移动(px)
					var PageWidth = 864; //翻页宽度
					var fill = 0; //整体移位
					var MoveLock = false;
					var MoveTimeObj;
					var Comp = 0;
					var AutoPlayObj = null;
					GetObj("List2").innerHTML = GetObj("List1").innerHTML;
					GetObj('ISL_Cont').scrollLeft = fill;
					GetObj("ISL_Cont").onmouseover = function() {
						clearInterval(AutoPlayObj);
					}
					GetObj("ISL_Cont").onmouseout = function() {
						AutoPlay();
					}
					AutoPlay();
					function GetObj(objName) {
						if (document.getElementById) {
							return eval('document.getElementById("' + objName
									+ '")')
						} else {
							return eval('document.all.' + objName)
						}
					}
					function AutoPlay() { //自动滚动
						clearInterval(AutoPlayObj);
						AutoPlayObj = setInterval(
								'ISL_GoDown();ISL_StopDown();', 6000); //间隔时间
					}
					function ISL_GoUp() { //上翻开始
						if (MoveLock)
							return;
						clearInterval(AutoPlayObj);
						MoveLock = true;
						MoveTimeObj = setInterval('ISL_ScrUp();', Speed);
					}
					function ISL_StopUp() { //上翻停止
						clearInterval(MoveTimeObj);
						if (GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0) {
							Comp = fill
									- (GetObj('ISL_Cont').scrollLeft % PageWidth);
							CompScr();
						} else {
							MoveLock = false;
						}
						AutoPlay();
					}
					function ISL_ScrUp() { //上翻动作
						if (GetObj('ISL_Cont').scrollLeft <= 0) {
							GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft
									+ GetObj('List1').offsetWidth
						}
						GetObj('ISL_Cont').scrollLeft -= Space;
					}
					function ISL_GoDown() { //下翻
						clearInterval(MoveTimeObj);
						if (MoveLock)
							return;
						clearInterval(AutoPlayObj);
						MoveLock = true;
						ISL_ScrDown();
						MoveTimeObj = setInterval('ISL_ScrDown()', Speed);
					}
					function ISL_StopDown() { //下翻停止
						clearInterval(MoveTimeObj);
						if (GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0) {
							Comp = PageWidth - GetObj('ISL_Cont').scrollLeft
									% PageWidth + fill;
							CompScr();
						} else {
							MoveLock = false;
						}
						AutoPlay();
					}
					function ISL_ScrDown() { //下翻动作
						if (GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth) {
							GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft
									- GetObj('List1').scrollWidth;
						}
						GetObj('ISL_Cont').scrollLeft += Space;
					}
					function CompScr() {
						var num;
						if (Comp == 0) {
							MoveLock = false;
							return;
						}
						if (Comp < 0) { //上翻
							if (Comp < -Space) {
								Comp += Space;
								num = Space;
							} else {
								num = -Comp;
								Comp = 0;
							}
							GetObj('ISL_Cont').scrollLeft -= num;
							setTimeout('CompScr()', Speed);
						} else { //下翻
							if (Comp > Space) {
								Comp -= Space;
								num = Space;
							} else {
								num = Comp;
								Comp = 0;
							}
							GetObj('ISL_Cont').scrollLeft += num;
							setTimeout('CompScr()', Speed);
						}
					}
				</script>
			</div>
			<div id="sheng9"></div>
			<div id="sheng10"></div>
			<div id="index_down"></div>
			<div id="quan8"></div>
			<div id="quan9"></div>
			<div id="index_down_image"><img src="images/yinfu.gif" width="900"></div>
			<div>
				<jsp:include page="./copyright.jsp"></jsp:include>
			</div>
		</div>
	</div>
</body>
</html>
